<?php
namespace app\model;

use think\Db;

class CommissionLog extends Common
{
    protected static $obj;

    public function _initialize()
    {
        parent::_initialize();
        $this->db_name = 'commission_log';
    }

    /**
     * 类入口
     * @return UserOrder
     */
    public static function getInstance()
    {
        if (is_null(self::$obj))
            self::$obj = new self();
        return self::$obj;
    }


    /*
     * 快递员订单记录及分佣
     */
    public function orderTotal($int_order_id)
    {
        $field = "count(id) as totalDeal,sum(fee) as totalFee";

        $where_arr = [
            'map_id' => $int_order_id,
            'gmt_create' => array('between',array(date("Y-m-d 00:00:00"),date("Y-m-d 23:59:59"))),
            'type' => 1
        ];

        $data = $this->toSelect($where_arr,$field);

//        echo Db::table($this->db_name)->getLastSql();
        return $data;
    }
}
